// vite.config.ts
import { defineConfig } from "file:///Users/lixingchen/Downloads/%E7%81%B5%E5%A8%83/lapp-template-master/node_modules/vite/dist/node/index.js";
import react from "file:///Users/lixingchen/Downloads/%E7%81%B5%E5%A8%83/lapp-template-master/node_modules/@vitejs/plugin-react/dist/index.mjs";

// lapp-vite-plugin.ts
import fs2 from "fs";
import path from "path";
import { safe as jsonc } from "file:///Users/lixingchen/Downloads/%E7%81%B5%E5%A8%83/lapp-template-master/node_modules/jsonc/index.js";
import chalk2 from "file:///Users/lixingchen/Downloads/%E7%81%B5%E5%A8%83/lapp-template-master/node_modules/chalk/index.js";

// script/misc/utils.mjs
import fs from "fs";
import chalk from "file:///Users/lixingchen/Downloads/%E7%81%B5%E5%A8%83/lapp-template-master/node_modules/chalk/index.js";
var gracefulSuicide = (msg, err) => {
  console.log(chalk.red("\n================= [build error] =================\n"));
  console.log(chalk.red(msg));
  if (err) {
    console.error(err);
  }
  console.log(chalk.red("\n================= [build error] =================\n"));
  process.exit(1);
};
var getFileBufferOrDie = (fileDest) => {
  try {
    const content = fs.readFileSync(fileDest);
    return content;
  } catch (error) {
    gracefulSuicide(`'${fileDest}' doesn't exsist, please make sure you've done 'npm run build' !`, error);
  }
};
var getJsonOrDie = (fileDest) => {
  try {
    const jsonObjBuffer = getFileBufferOrDie(fileDest);
    const jsonObj = JSON.parse(jsonObjBuffer.toString());
    return jsonObj;
  } catch (error) {
    gracefulSuicide(`File ${fileDest} isn't a valid JSON, please make sure you've configured it right !`, error);
  }
};

// script/misc/config.mjs
var BUILD_DEST = "build";
var META_DEST = "lapp-meta.json";
var CDN_DOMAIN = "open-isv-assets.1688.com";
var CDN_PATH_MAP = {
  "PC": "pc-pc_work-pc_work_plugin-",
  "MOBILE": "mobile-mobile_app-mobile_app_plugin-"
};

// lapp-vite-plugin.ts
var __vite_injected_original_dirname = "/Users/lixingchen/Downloads/\u7075\u5A03/lapp-template-master";
function lappPlugin() {
  const { appKey: appKey2, version: version2, platform: platform2 } = getJsonOrDie("package.json");
  if (typeof appKey2 !== "string") {
    gracefulSuicide("Please make sure appKey is defined in package.json according to README.md");
  }
  if (typeof version2 !== "string") {
    gracefulSuicide("Please make sure version is defined in package.json according to README.md");
  }
  if (platform2 !== "PC" && platform2 !== "MOBILE") {
    gracefulSuicide("Please make sure platform is defined in package.json according to README.md");
  }
  let initialized = false;
  return {
    name: "lapp-plugin",
    async closeBundle(error) {
      let lappMetaStrFormatted = "";
      try {
        const lappMetaBuffer = fs2.readFileSync(META_DEST);
        const [err, result] = jsonc.parse(lappMetaBuffer.toString());
        if (err) {
          gracefulSuicide(`Failed to parse JSON: ${err.message}`, err);
        }
        lappMetaStrFormatted = JSON.stringify(result, null, 4);
        fs2.writeFileSync(path.join(BUILD_DEST, META_DEST), lappMetaStrFormatted);
      } catch (error2) {
        gracefulSuicide(`File ${META_DEST} doesn't exsist, please make sure you've configured it right !`, error2);
      }
      if (process.argv.indexOf("--watch") !== -1 && initialized === false) {
        let devUrl = `https://page.1688.com/html/isv-bridge.html?appKey=${appKey2}&version=${version2}`;
        if (platform2 === "MOBILE") {
          devUrl = `${devUrl}&platform=MOBILE`;
        }
        const buildDestFullPath = path.resolve(path.join(__vite_injected_original_dirname, BUILD_DEST));
        const globSection = path.sep === "\\" ? "\\$3" : "$3";
        const proxyRule = `^***${CDN_DOMAIN}/${CDN_PATH_MAP[platform2]}${appKey2}/*/*** file://${buildDestFullPath}${path.sep}${globSection}`;
        console.log(chalk2.cyan("\n====================== Environment Info =====================\n"));
        console.log(chalk2.cyan(`
lapp-meta.json:
${lappMetaStrFormatted}

Please install whistle as local proxy server:
${chalk2.underline("https://wproxy.org/whistle/install.html")}

Example for whistle proxy rule:
${proxyRule}

Please make sure you've configured the proxy server properly, then open the local Dev URL below :
${chalk2.underline(devUrl)}


`));
        console.log(chalk2.cyan("\n====================== Environment Info =====================\n"));
        initialized = true;
      }
    }
  };
}

// vite.config.ts
var MODE = process.argv.indexOf("--watch") !== -1 ? "development" : "production";
var { appKey, version, platform } = getJsonOrDie("package.json");
var base = `https://${CDN_DOMAIN}/${CDN_PATH_MAP[platform]}${appKey}/${version}/`;
var vite_config_default = defineConfig({
  mode: MODE,
  define: {
    // 指定 NODE_ENV 方便 react 等库动态依赖不同子包
    "process.env.NODE_ENV": JSON.stringify(MODE)
  },
  plugins: [
    react(),
    lappPlugin()
  ],
  base,
  build: {
    sourcemap: MODE === "development",
    minify: MODE === "production",
    target: "es2015",
    outDir: "build",
    rollupOptions: {
      output: {
        // 线上是非覆盖式发布，URL带版本号，构建产物的[hash]没有意义，所以禁用掉
        entryFileNames: `[name].js`,
        chunkFileNames: `chunk/[name].js`,
        assetFileNames: `[name].[ext]`
        // 只托管css资源，图片等媒体资源，请自行上传CDN后在代码内引用
      }
    }
  }
});
export {
  vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiLCAibGFwcC12aXRlLXBsdWdpbi50cyIsICJzY3JpcHQvbWlzYy91dGlscy5tanMiLCAic2NyaXB0L21pc2MvY29uZmlnLm1qcyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiY29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2Rpcm5hbWUgPSBcIi9Vc2Vycy9saXhpbmdjaGVuL0Rvd25sb2Fkcy9cdTcwNzVcdTVBMDMvbGFwcC10ZW1wbGF0ZS1tYXN0ZXJcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZmlsZW5hbWUgPSBcIi9Vc2Vycy9saXhpbmdjaGVuL0Rvd25sb2Fkcy9cdTcwNzVcdTVBMDMvbGFwcC10ZW1wbGF0ZS1tYXN0ZXIvdml0ZS5jb25maWcudHNcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfaW1wb3J0X21ldGFfdXJsID0gXCJmaWxlOi8vL1VzZXJzL2xpeGluZ2NoZW4vRG93bmxvYWRzL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